import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetGetMetricsId_ {
  /**
   * @description 审核流程的唯一标识
   */
  processId: string;
}

export class Approval {
  /**
   * 修改审批流程
   *
   * @tags 审批controller
   * @request POST: /approval/center/process/result
   * @secure
   */
  postCenterProcessResult = (approvalResultDTO: defs.ApprovalResultDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/approval/center/process/result`,
      method: "POST",
      data: approvalResultDTO,
      ...params,
    });

  /**
   * 创建审批流程
   *
   * @tags 审批controller
   * @request POST: /approval/create
   * @secure
   */
  postCreate = (createApprovalDto: defs.CreateApprovalDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/approval/create`,
      method: "POST",
      data: createApprovalDto,
      ...params,
    });

  /**
   * 通过审核流程的唯一标识获取指标id
   *
   * @tags 审批controller
   * @request GET: /approval/get-metricsId
   * @secure
   */
  getGetMetricsId = ({ processId }: { processId: string } | GetGetMetricsId_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityInt>({
      url: `/approval/get-metricsId`,
      method: "GET",
      ...params,
    });
}

export default new Approval();
